package com.rimi.commons;



/**
 * @
 * @author:liangLi
 * @time:2020/7/6 14:12
 */
public class CommonsResult implements ResultCode{
    private Integer code;

    private String message;

    public CommonsResult(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public CommonsResult(ResultStaus staus){
        this.code=staus.code;
        this.message=staus.message;
    }

    /**
     * 默认成功的消息返回
     * @return
     */

    public static CommonsResult onSuccess(){
        return new CommonsResult(ResultStaus.OK);
    }

    /**
     * 默认失败的消息返回
     * @return
     */
    public static CommonsResult onFailed(ResultStaus resultStaus){
        return new CommonsResult(resultStaus);
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return message;
    }
}
